package gl.common;


import gl.uitls.Lg;
import net.tsz.afinal.http.AjaxCallBack;
import de.greenrobot.event.EventBus;

public class AjaxCallBackProxyNoProgress extends AjaxCallBack<String> {

	@Override
	public void onStart() {
		super.onStart();
	}
	@Override
	public void onSuccess(String t) {
		super.onSuccess(t);
		if (t!=null) {
			Lg.i("http","response:"+ t);
		}else{
			Lg.i("http", "response:null");
		}
		
	}

	@Override
	public void onFailure(Throwable t, int errorNo, String strMsg) {
		super.onFailure(t, errorNo, strMsg);
		Lg.e("http", "err:"+strMsg);
		handlerErrCode(errorNo);
	}

	private void handlerErrCode(int errorNo) {
		switch (errorNo) {
		case 401:
			EventBus.getDefault().post(new GoToLogin());
			break;
		default:
			break;
		}

	}
	
}
